import { Nodes } from '@knno/dom';
import { Rule, RouterView as UIRouterView } from '../components/routerView/routerView';
import { JSXProps } from '@knno/dom/jsx';
import { AttrCheck, isArray, jsxBuild } from './utils';

export { UIRouterView };

interface RouterViewProps extends JSXProps<UIRouterView> {
	rules?: Rule[];
}

const ATTRS: AttrCheck = {
	rules: isArray,
};

export function RouterView(props: RouterViewProps, children: Nodes[]): UIRouterView {
	return jsxBuild(new UIRouterView(), props, children, ATTRS);
}
